#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qmylabel.h"
#include<QHBoxLayout>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
    if (obj == ui->label)
    {
        if (event->type() == QEvent::MouseButtonPress)
        {
            qDebug() << "QMyLabel:eventFilter";
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        // pass the event on to the parent class
        return QMainWindow::eventFilter(obj, event);
    }
}
